import request from '@/utils/request'

// 创建订单
export const createOrder = (data) => {
  return request({
    url: '/order/create',
    method: 'post',
    data
  })
}

// 获取订单列表
export const getOrderList = (params) => {
  return request({
    url: '/order/list',
    method: 'get',
    params
  })
}

// 获取订单详情
export const getOrderDetail = (id) => {
  return request({
    url: `/order/${id}`,
    method: 'get'
  })
}

// 根据订单号获取订单
export const getOrderByNo = (orderNo) => {
  return request({
    url: `/order/no/${orderNo}`,
    method: 'get'
  })
}

// 获取订单统计
export const getOrderStats = () => {
  return request({
    url: '/order/stats/summary',
    method: 'get'
  })
}

// 更新订单状态
export const updateOrderStatus = (id, data) => {
  return request({
    url: `/order/update/${id}`,
    method: 'put',
    data
  })
}

// 取消订单
export const cancelOrder = (id) => {
  return request({
    url: `/order/cancel/${id}`,
    method: 'put'
  })
}

// 删除订单
export const deleteOrder = (id) => {
  return request({
    url: `/order/delete/${id}`,
    method: 'delete'
  })
}











